import { defineStore } from "pinia";
import { ref } from "vue";
export const useAddDataStore = defineStore("addData", () => {
  const from = ref<any>({
    category: "",
    pid: "",
    name: "",
    status: "",
    community_id: "",
    city: [],
    location: "",
    point: {},
  });
  const policeForm = ref<any>({
    category: 0,
    region_code: [],
    name: "",
    status: null,
    location: "",
    point: {},
    communities: [
      {
        name: "",
        id: 0,
        rated: null,
      },
    ],
  });
  const testflag = ref(true);
  const backFlag = ref<boolean>(false); //返回上一步判断
  const edit = ref<boolean>(false); //新增或编辑的判定
  const business = ref<boolean>(true); //用于提交时判断商户还是派出所
  const permission_codes = ref<any>();
  const region = ref<string>(""); //储存区域
  const defenseCommunity = ref<any>("");
  return {
    from,
    backFlag,
    region,
    policeForm,
    edit,
    permission_codes,
    business,
    defenseCommunity,
    testflag,
  };
});
